//
//  WFBaseTableView.m
//  谷居
//
//  Created by dllo on 16/6/17.
//  Copyright © 2016年 刘万方. All rights reserved.
//

#import "WFBaseTableView.h"

@implementation WFBaseTableView
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
    self = [super initWithFrame:frame style:style];
    if (self) {
        [self setColor];
        [self addObserver];
    }
    return self;
}
- (void)setColor {
    if (!IS_LONG) {
        self.backgroundColor = DAY_COLOR;
    } else {
        self.backgroundColor = NIGHT_COLOR;
    }
    
}

- (void)addObserver {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeToNight:) name:@"夜间模式" object:nil];
    
}
-(void)changeToNight:(NSNotification *)sender {
    if (!IS_LONG) {
        self.backgroundColor = NIGHT_COLOR;
    } else {
        self.backgroundColor = DAY_COLOR;
    }
}
- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];

    [super dealloc];
}
@end
